<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%><!-- struts的tag(標籤) 固定用法 -->
<%@ taglib uri="/pagination-tags" prefix="p"%><!-- 分頁的tag(標籤) 固定用法 -->

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Test</title>
		<link type="text/css" rel="stylesheet" href="<s:url value="./base/css/page.css" />" />
		<script type="text/javascript" src="<s:url value="./base/script/jquery.js" />"></script>
		<script type="text/javascript">
			function pageSizeOnchange(obj, targetObjId){
				$("tr[name='tr_" + targetObjId + "']:visible").css("display", "none");
				goToNextPage('normal', null, null, 'qryByDBDiv', 'firstPage', <s:property value="qryListForDB.size()"/>, obj.value, null, "all", "abc");
				$("#" + targetObjId + " select[name='pageSize']").val(obj.value);
			}
			
			function delForDB(){
				alert(qryListForDB.size())
			}
		</script>
	</head>
	<body>
		<div class="pagination" style="float:left;">
			每頁顯示：
			<s:select name="pageSize" list="#{'5':'5', '10':'10', '15':'15', '20':'20'}" onchange="pageSizeOnchange(this);"></s:select>
			筆，<a href="javascript:" onclick="delForDB();">刪除</a>
		</div>
		<p:body displaySpace="start" paginationType="normal" targetObjId="qryByDBDiv" returnChkId="qryListForDB" chkAllObjId="all" chkObjName="abc"/>
		<table width="100%" border="1">
			<tr>
				<th style="width: 4%" align="center">
					<p:checkbox paginationType="normal" chkType="chkAll" targetObjId="qryByDBDiv" returnChkId="qryListForDB" chkAllObjId="all" chkObjName="abc"  row="" title="全選/全不選" />
				</th>
				<th style="width: 48%">No.</th>
				<th style="width: 48%">value</th>
			</tr>
			<s:iterator id="qryListForDB" value="qryListForDB" status="cStatus">
				<s:set name="row" value="#cStatus.index" />
				<p:tr targetObjId="qryByDBDiv" row="${row}">
					<td align="center">
						<s:set name="value" value="(pageSize * (currentPage - 1)) + #cStatus.index + 1" />
						<p:checkbox paginationType="normal" chkType="chk" targetObjId="qryByDBDiv" returnChkId="qryListForDB" chkAllObjId="all" chkObjName="abc"  row="${row}" value="${value}" />
					</td>
					<td><s:property value="#cStatus.index + 1" /></td>
					<td><s:property value="#qryListForDB" /></td>
				</p:tr>
			</s:iterator>
		</table>
		<div class="pagination" style="float:left;">
			每頁顯示：
			<s:select name="pageSize" list="#{'5':'5', '10':'10', '15':'15', '20':'20'}" onchange="pageSizeOnchange(this);"></s:select>
			筆
		</div>
		<p:body displaySpace="end" paginationType="normal" targetObjId="qryByDBDiv" />
	</body>
</html>